home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 5
/
Aminet 5 - March 1995.iso
/
Aminet
/
gfx
/
show
/
jpegAGAsrc21.lha
/
jpegAGAsrc
/
jpegAGA
/
ASLScreenMode.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-01-14
|
2KB
|
96 lines
/* Display an ASL screenmode requester */
/* modified for use with jpegAGA 2.x */
#include <exec/types.h>
#include <libraries/asl.h>
#include <utility/tagitem.h>
#ifndef __GNUC__
#include <pragmas/exec_pragmas.h>
#include <pragmas/graphics_pragmas.h>
#include <pragmas/asl_pragmas.h>
#include <clib/exec_protos.h>
#include <clib/graphics_protos.h>
#include <clib/asl_protos.h>
#else
#include <inline/exec.h>
#include <inline/graphics.h>
#include <inline/asl.h>
#endif
extern ULONG SMR_DisplayID;
extern short SMR_HAM;
struct Library *AslBase=NULL;
extern struct GfxBase *GfxBase;
struct TagItem smrtags[] =
{ { ASLSM_PropertyFlags, DIPF_IS_AA},
{ ASLSM_PropertyMask, DIPF_IS_DUALPF | DIPF_IS_EXTRAHALFBRITE},
{ ASLSM_TitleText, 0 },
{ TAG_DONE, 0 }
};
int ChooseScreenMode(int grayscale, char *title)
{
struct ScreenModeRequester *smr;
int ASL_failure=1;
if(grayscale)
smrtags[1].ti_Data = DIPF_IS_DUALPF | DIPF_IS_EXTRAHALFBRITE | DIPF_IS_HAM;
else
smrtags[1].ti_Data = DIPF_IS_DUALPF | DIPF_IS_EXTRAHALFBRITE;
smrtags[2].ti_Data = (ULONG)((void *)title);
if(!GfxBase)
{
if(!(GfxBase = (struct GfxBase *)OpenLibrary((UBYTE *)"graphics.library",39)))
{
printf("Could not open graphics.library V39 or higher.\n");
return 1;
}
}
if( AslBase=OpenLibrary("asl.library", 39L) )
{
if( smr = (struct ScreenModeRequester *)
AllocAslRequest(ASL_ScreenModeRequest, smrtags) )
{
if( AslRequest(smr, 0L) )
{
struct DisplayInfo queryinfo;
/* printf("Display type: $%lx\n", smr->sm_DisplayID); */
SMR_DisplayID = smr->sm_DisplayID;
if(GetDisplayInfoData(NULL, (UBYTE *)&queryinfo, sizeof(queryinfo),DTAG_DISP,SMR_DisplayID))
{
if(queryinfo.PropertyFlags)
{
if(queryinfo.PropertyFlags & DIPF_IS_HAM)
SMR_HAM = 1;
else SMR_HAM = 0;
/* if(SMR_HAM) printf("Mode is HAM\n"); */
}
else ASL_failure = 1;
}
ASL_failure=0;
}
else
{
/* printf("User cancelled or error...\n"); */
ASL_failure=1;
}
FreeAslRequest(smr);
}
CloseLibrary(AslBase);
return ASL_failure;
}
printf("Could not open asl.library V39 or higher.\n");
return 1;
}